import React from 'react';

export type TStatus =
  | 'initial'
  | 'preparing'
  | 'uploading'
  | 'complete'
  | 'error';

export type TFile = {
  postUrl?: string;
  vid: string;
  fileName?: string;
};

export interface YmUploadVideoProps {
  id?: string; //视频预览播放器dom id
  cardWidth?: number; // 300
  cardHeight?: number;
  label?: string;
  type?: string[];
  maxSize?: number;
  dir?: string;
  accept?: string;
  value?: TFile[] | TFile | undefined;
  maxCount?: number;
  disabled?: boolean;
  onChange?: (newValue: TFile[] | TFile | undefined, fileInfo?: any) => void;
  required?: boolean;
  multiple?: boolean;
  children?: React.ReactNode;
  userId?: string;
  warningChildren?: React.ReactNode;
  hideWarningChildren?: boolean;
  getUploadAuthTokenApi?: (params?: any) => Promise<any>;
  getPlayerAuthTokenApi?: (params?: any) => Promise<any>;
}

export interface YmVideoPlayerProps {
  id?: string; //视频预览播放器dom id
  width: number;
  height: number;
  url?: string;
  postUrl?: string;
  getVideoByToken?: {
    playAuthToken: string;
    playDomain?: string; //	请求地址接口域名。默认值为 '//vod.volcengineapi.com'
    reqParams?: Record<string, any>;
    definitionMap?: Record<string, any>;
    needPoster?: boolean;
    needThumbs?: boolean;
    needBarrageMask?: boolean;
    keyToken?: boolean;
  };
  languages?: Record<string, any>;
  onTokenExpired?: () => Promise<any>; //自动更新 PlayAuthToken
  volume?: number; //音量
  loop?: boolean; // 循环播放
  // 视频旋转按钮配置项，默认值：{ innerRotate: false, clockwise: false }
  rotate?: {
    innerRotate?: boolean; //只旋转内部video
    clockwise?: boolean; // 旋转方向是否为顺时针
  };
  vodLogOpts?: Record<string, any>; //播放质量上报
  onInitialPlayerInstance?: (player: any) => void;
  getPlayerAuthTokenApi?: (params?: any) => Promise<any>;
  [propName: string]: any;
}

export interface IUploadAuthTokenDetail {
  accessKeyId: string;
  currentTime: string;
  expiredTime: string;
  secretAccessKey: string;
  sessionToken: string;
}
